import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/layout/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
  
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue')
    },
    {
      path:'/register',
      name:'register',
      component:()=>import('@/views/register/index.vue')
    },
    {
      path:'/',
      name:'layout',
      component:Layout,
      redirect:'/article',
      children:[
        {
          path:'/article',
          name:'article',
          component:()=>import('@/views/article/index.vue')
        },
        {
          path:'/collect',
          name:'collect',
          component:()=>import('@/views/collect/index.vue')
        },
        {
          path:'/like',
          name:'like',
          component:()=>import('@/views/like/index.vue')
        },
        {
          path:'/user',
          name:'user',
          component:()=>import('@/views/user/index.vue')
        }
      ]
    },
    {
      path:'/articleDetail/:id?',
      name:'articleDetail',
      component:()=>import('@/views/articleDetail/index.vue')
    }
  ]
})

export default router
